package com.virtualmall.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.virtualmall.bean.ShoppingCart;
import com.virtualmall.common.Page;
import com.virtualmall.service.BaseService;
import com.virtualmall.service.ShoppingCartService;

@Service
@Transactional
public class ShoppingCartServiceImpl extends BaseService implements ShoppingCartService {

	public void create(ShoppingCart shoppingCart) {
		this.shoppingCartDao.create(shoppingCart);
	}

	public void delete(ShoppingCart shoppingCart) {
		this.shoppingCartDao.delete(shoppingCart);
	}

	public List<ShoppingCart> getShoppingCartList(Long userId,Page page) {
		return this.shoppingCartDao.getShoppingCartList(userId,page);
	}

	public Long getShoppingCartListCount(Long userId) {
		return this.shoppingCartDao.getShoppingCartListCount(userId);
	}

    public void update(ShoppingCart shoppingCart) {
        this.shoppingCartDao.update(shoppingCart);
    }

	@Override
	public List<ShoppingCart> read(ShoppingCart shoppingCart) {
		return this.shoppingCartDao.read(shoppingCart);
	}

	@Override
	public void delete(Long userId) {
		this.shoppingCartDao.delete(userId);
	}

    @Override
    public ShoppingCart read(Long id) {
        return this.shoppingCartDao.read(id);
    }

    @Override
    public Double getShoppingCartTotalPrice(Long userId) {
        return this.shoppingCartDao.getShoppingCartTotalPrice(userId);
    }
}
